import { activeEnum, sysEnum } from "@/biz/eenum/appEnum";

/**
 * @description 岗位当前的进度
 * @returns {number}
 */
export function getCurStep(jobstatus: number) {
    if (jobstatus) {
        if (jobstatus == sysEnum.SIX) return 1;
        if (jobstatus == sysEnum.ONE) return 3;
        if (jobstatus == sysEnum.TEN) return 4;
        if (jobstatus == sysEnum.ELEVEN) return 5;
        if (jobstatus == sysEnum.TWELVE) return 6;
        if (jobstatus == sysEnum.EIGHT) return 7;
    }
    return 1;
}

/**
 * @description 获取岗位的进度
 * @returns any[]
 */
export function getJobSteps(job: { flagAbnormal: string }) {
    if (job) {
        if (job.flagAbnormal && job.flagAbnormal === activeEnum.ACTIVE) {
            return [
                {
                    title: "提交",
                    description: job.createDate || "",
                    value: "1"
                },
                {
                    title: "售后中",
                    description: "",
                    value: "2"
                },
                {
                    title: "已完成",
                    description: "",
                    value: "3"
                }
            ];
        } else {
            return [
                {
                    title: "提交",
                    description: job.createDate || "",
                    value: "1"
                },
                {
                    title: "审核",
                    description: job.auditDate || "",
                    value: "2"
                },
                {
                    title: "招聘中",
                    description: job.pubDate || "",
                    value: "3"
                },
                {
                    title: "接单确认",
                    description: job.confirmDate || "",
                    value: "4"
                },
                {
                    title: "支付订单",
                    description: job.payDate || "",
                    value: "5"
                },
                {
                    title: "处理中",
                    description: "",
                    value: "6"
                },
                {
                    title: "完成",
                    description: job.doneDate || "",
                    value: "7"
                }
            ];
        }
    }
    return [];
}

/**
 * 返回地址的省市信息
 */
export function getAddressPC(address: {}): string {
    if (address) {
        return (address.provinceName || "-") + "-" + (address.cityName || "-");
    }
    return "";
}

/**
 * 返回地址的省市信息
 */
export function getAddressDetail(address: {}): string {
    if (address) {
        return "-" + (address.areaName || "") + " " + address.address;
    }
    return "";
}
